package com.gs.core.service.impl;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.gs.core.domain.Action;
import com.gs.core.repository.ActionRepository;
import com.gs.core.service.ActionService;

@Service(value="actionService")
public class ActionServiceImpl implements ActionService{

	@Autowired
	ActionRepository actionRepository;
	
	public Action findById(Long id) {
		return actionRepository.findOne(id);
	}
	@Transactional(propagation=Propagation.MANDATORY)
	public Action saveOrUpdate(Action entity) {
		return actionRepository.save(entity);
	}
	@Transactional(propagation=Propagation.MANDATORY)
	public void delete(Action entity) {
		actionRepository.delete(entity);
	}
	@Transactional(propagation=Propagation.MANDATORY)
	public void deleteAll() {
		actionRepository.deleteAll();
//		if(true){
//			throw new NullPointerException("Throw ");
//		}		
	}
	public List<Action> findAll() {
		return actionRepository.findAll();
	}

}
